IndexedDB: Add implementation of MediaRetentionPolicy-related functions in EventCacheStoreMedia#5574
Merged
Hywan merged 8 commits intomatrix-org:mainfrom Aug 27, 2025
Conversation
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
… to EventCacheStoreMedia implementation Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…che database Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…licy Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…licy fns Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5574 +/- ##
==========================================
- Coverage 88.63% 88.63% -0.01%
==========================================
Files 340 340
Lines 95102 95102
Branches 95102 95102
==========================================
- Hits 84298 84296 -2
- Misses 6616 6619 +3
+ Partials 4188 4187 -1 ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #5574 will not alter performanceComparing Summary
|
Member
|
The The cleanup phase is done in a separate task. The task handle is stored here: If it is really annoying for you, we may want to revisit this. |
1 task
This was referenced Sep 16, 2025
1 task
Merged
1 task
This was referenced Dec 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
This pull request is part of a series of pull requests to add a full IndexedDB implementation of the
EventCacheStore(see #4617, #4996, #5090, #5138, #5226, #5274, #5343, #5384, #5406, #5414, #5497, #5506, #5540). This particular pull request adds aMemoryStore-backed implementation ofEventCacheStoreMedia, as well as, IndexedDB-backed implementations forMediaRetentionPolicy-related functions.Changes
The overarching change adds a
MemoryStore-backed implementation ofEventCacheStoreMediaforIndexeddbEventCacheStore. Furthermore, the implementation ofEventCacheStorenow delegates to the implementation ofEventCacheStoreMediavia aMediaServicenested inIndexeddbEventCacheStore.Additionally, there are now implementations and tests for the following
EventCacheStoreMediafunctions.EventCacheStoreMedia::media_retention_policy_innerIndexeddbEventCacheStoreTransaction::get_media_retention_policyEventCacheStoreMedia::set_media_retention_policy_innerAnd finally, to support these queries, the
COREobject store now has a primary key with key pathid.Caveats
EventCacheStoreMediarequires that the implementing type beCloneable. Consequently, some rather minimal changes were required in order to supportClone.There is, however, one notable change for supporting
Clone, which is thatIndexeddbEventCacheStore.innerwent from being anIdbDatabaseto anRc<IdbDatabase>.While this may seem like a problem in a concurrent environment, it is ultimately not an issue, as IndexedDB ensures that only a single transaction is running at a time. Any interfering transaction will be canceled by IndexedDB and return an error.
The downside of this architecture, however, is that it would require re-trying in a loop if multiple instances of
IndexeddbEventCacheStorewere contending for access.An alternative would be to use a
tokio::sync::Mutexin conjunction with anArc, which would replace the loop with anawait. The consequences of this are that the implementation ofIndexeddbEventCacheStoreTransactionbecomes rather tricky, as it seems to require a self-referential struct.I'm not entirely sure why the
EventCacheStoreMediarequiresCloneand how it will be used, so I opted for using anRcas it was far more straightforward and still a sound approach.Future Work
EventCacheStoreMediafunctionsSigned-off-by: Michael Goldenberg m@mgoldenberg.net